import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import './App'
import reportWebVitals from './reportWebVitals';




export default class App extends Comment{
    constructor(props) {
        super(props);
        //状态机
        this.state = {
            date:new Date(),
            userinfo:[],
            total:10
        };
    }
    //生命周期函数,挂载完成
    componentDidMount(){
        axios.get("/my").then(res=>{
            //异步更改state数据
            this.setState({
                userInfo:res.date
            })
        })
        //异步更改数据
        this.setState({
            total:20
        })
    }
    render(){
        //解构赋值
        let{date,userinfo,total}=this.state
        return(
            <div>
                <div className="App"></div>
            </div>
        )

    }
}


ReactDOM.render(
    <App />,
    document.getElementById('example')
);
